﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Open.Infrastructure
{
    /// <summary>
    /// ButtonBase 扩展
    /// </summary>
    public static class ButtonBaseExtension
    {
        /// <summary>
        /// 引发 <see>
        /// <cref>Primitives.ButtonBase.Click</cref>
        /// </see>
        /// 路由事件。
        /// </summary>
        /// <param name="buttonBase">要引发路由事件的按钮</param>
        public static void OnClick(this System.Windows.Controls.Primitives.ButtonBase buttonBase)
        {
            buttonBase.GetType().GetMethod(nameof(OnClick), BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(buttonBase, null);
        }
    }
}
